import React,{Component} from "react";
import ToChild1 from "./Child1";
import ToChild2 from "./Child2";
import ToChild3 from "./Child3使用contextType";

//1.导入共享数据
import { glabalContext,glabalData,globalAction } from "./common/js/globalData";
//2.合并state(状态)  数据
//3.解构glabalContext
const {Provider} = glabalContext
class ToChildParent extends Component {
  state = {
      ...glabalData,
      ...globalAction(this)
  }
  render(){
    return (
      <div>
        <Provider value={this.state}>
          父组件读取role=:{this.state.role}
          <ToChild1 footer={<div>footer区域</div>}>
              匿名插槽==props.children
          </ToChild1>
          <ToChild2/>
          <ToChild3/>
        </Provider>
      </div>
    )
  }
}
export default ToChildParent;